import request from "@/utils/request.js";

/**
 * 分页查询应用
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const queryAppPage = (data) => {
  return request.post("/admin/app/page", data);
};

/**
 * 通过id查询应用
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const queryAppById = (data) => {
  return request.get("/admin/app/" + data);
};

/**
 * 新增应用
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const saveApp = (data) => {
  return request.post("/admin/app", data);
};

/**
 * 删除应用
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const removeApp = (data) => {
  return request.delete("/admin/app", { data });
};

/**
 * 更新应用
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const updateApp = (data) => {
  return request.put("/admin/app", data);
};

/**
 * 导出应用表格
 */
export const exportApp = (data) => {
  return request.post("/admin/app/export", data, { responseType: "blob" });
};

/**
 * 审核应用
 */
export const reviewApp = (data) => {
  return request.post("/admin/app/review", data);
};

/**
 * 设置应用推荐状态
 * @param id
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const setAppRecommendStatus = (id,data) => {
  return request.post("/admin/app/recommend/" + id +'/' + data);
}
